import * as echarts from 'echarts';
export default function (el: HTMLElement) {
  const echartInstacne = echarts.init(el);
  const setOptions = (options: echarts.EChartsOption) => {
    echartInstacne.setOption(options);
  };
  window.addEventListener('resize', () => {
    echartInstacne.resize();
  });
  const updateSize = () => {
    echartInstacne.resize();
  };
  return {
    echartInstacne,
    setOptions,
    updateSize
  };
}
